﻿@{
    ViewData["Title"] = "运行日志";
    ViewData["Mbx"] = "日志管理";
    Layout = "_Default";
}

@section css{
    <style>

        .fliter {
            width: 80%;
            height: 40px;
            align-items: center;
            display: flex;
            margin-bottom: 10px;
        }

            .fliter .search-btn {
                margin-left: 20px;
            }

            .fliter .input-text {
                width: 150px;
            }

            .fliter .label-eq-name {
                margin-left: 20px;
            }

            .fliter .label-eq-code {
                margin-left: 20px;
            }

            .fliter .input-text-eq-code {
                width: 150px;
                height: 23px;
            }

        .select-box {
            width: 150px;
        }

        .label-sc-name {
            margin-left: 20px;
        }

        .fliter .input-text-sc-name {
            width: 150px;
            height: 23px;
        }

        .label-issc-type {
            margin-left: 20px;
        }

        .btn-add {
            margin-left: 20px;
        }
    </style>
}

    @section gray{
    @*<div class="btn-add">
    <span class="l">
        <a class="btn btn-primary radius" href="javascript:;" onclick="common_add('添加PLC连接配置','/plcconnectioninfo/plcconnectinfoaddoredit','600')">
            <i class="Hui-iconfont">&#xe600;</i> 新增
        </a>
    </span>
</div>*@

    <div class="fliter">
        <label class="label-eq-code">业务类型：</label>
        <input type="text" class="input-text" value="" placeholder="" id="RunType" name="RunType">
        <label class="label-eq-code">业务内容：</label>
        <input type="text" class="input-text" value="" placeholder="" id="RunLog" name="RunLog">
        <label class="label-eq-code">托盘码：</label>
        <input type="text" class="input-text" value="" placeholder="" id="ContainerBarcode" name="ContainerBarcode">
        <label class="label-eq-code">设备号：</label>
        <input type="text" class="input-text" value="" placeholder="" id="EquipmentCode" name="EquipmentCode">
        
    </div>
     <div class="fliter">
         <label class="label-eq-code ">创建时间：</label>
        <input type="text" class="input-text Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm', maxDate:'#F{$dp.$D(\'endTime\')||\'%y-%M-%d %H:%m\'}' })" id="startTime">---
        <input type="text" class="input-text Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'#F{$dp.$D(\'startTime\')}',maxDate:'%y-%M-%d %H:%m'})" id="endTime">&nbsp;&nbsp;&nbsp;&nbsp;
        @* <label class="label-sc-name">堆垛机编码：</label>
    <input type="text" class="input-text" value="" placeholder="" id="scCode" name="scCode">*@
        <input class="btn btn-primary radius search-btn" type="button" onclick="search()" value="&nbsp;&nbsp;搜索&nbsp;&nbsp;">
         </div>
}


    <table class="table table-border table-bordered table-hover table-bg table-sort">
        <thead>
        </thead>
        <tbody>
        </tbody>
    </table>

    @section javascript{
    <script type="text/javascript" src="~/lib/My97DatePicker/4.8/WdatePicker.js"></script>

    <script>
        $(function () {
            function formatData(date) {
                var seperator1 = "-";
                var month = date.getMonth() + 1;
                var strDate = date.getDate();
                //var strHour = date.getHours();
                //var strMinute = date.getMinutes();
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                if (strDate >= 0 && strDate <= 9) {
                    strDate = "0" + strDate;
                }
                var formatStr = date.getFullYear() + seperator1 + month + seperator1 + strDate;
                return formatStr;
            }
            function initDate() {
                //设置结束日期为当前日期
                var date = new Date();
                var formatStr = formatData(date);
                formatStr = formatStr + " 23:59";
                $("#endTime").val(formatStr);

                //设置开始日期为当前日期的前7天
                date.setDate(date.getDate() - 1);
                var formatStr1 = formatData(date);
                formatStr1 = formatStr1 + " 00:01";
                $("#startTime").val(formatStr1);
            }
            initDate();
            initData("");
        });


        function search() {
            var RunType = $("#RunType").val();
            var RunLog = $("#RunLog").val();
            var ContainerBarcode = $("#ContainerBarcode").val();
            var EquipmentCode = $("#EquipmentCode").val();
            var StartTime = $("#startTime").val();
            var EndTime = $("#endTime").val();
            initData(RunType, ContainerBarcode, EquipmentCode, RunLog,StartTime,EndTime);
        }

        function initData(RunType, ContainerBarcode, EquipmentCode, RunLog,StartTime,EndTime) {
            $('.table-sort').dataTable({
                bProcessing: true, //DataTables 载入数据时，是否显示‘进度’提示
                bAutoWidth: false, //自动宽度
                bSort: false, //排序功能
                paging: true, //是否分页
                bInfo: true, //页脚信息,默认为 true
                bStateSave: false, //状态保存
                sPaginationType: "full_numbers", //分页显示样式
                serverSide: true, //启用服务器分页
                //sAjaxSource: "/admin/functionlist", //服务端请求数据接口
                searching: true, //关闭 datatables 的搜索框
                destroy: true, //解决重新渲染问题
                iDisplayLength: 10, //每页显示数量
                ajax: {
                    url: "/runlog/getrunloginfo",
                    type: "POST",
                    contentType: "application/x-www-form-urlencoded",
                    async: false,
                    dataType: "json",
                    data: function(data) {
                        data.ContainerBarcode = ContainerBarcode;
                        data.RunType = RunType;
                        data.RunLog = RunLog;
                        data.EquipmentCode = EquipmentCode;
                        data.StartTime = StartTime;
                        data.EndTime = EndTime;
                    },
                    dataFilter: function(json) {
                        console.log(json);
                        return json;
                    }
                },

                aoColumns: [
                    // mDataProp：绑定数据属性
                    // sDefaultContent：设置默认值
                    // sClass：添加 class 属性，不懂的直接去掉
                    // sTtile：设置列标题
                    // sWidth：设置列宽度
                    // sTtile 设置的内容，会替换到 html thead 中的“标题”
                    //{mDataProp:"js_Id", sClass:"text-c",  sTitle:"编号",sDefaultContent:""},
                    { mDataProp: "js_ID", sClass: "text-c", sTitle: "ID", sDefaultContent: "", sWidth: "15%" },
                    { mDataProp: "containerBarcode", sClass: "text-c", sTitle: "托盘码", sDefaultContent: "", sWidth: "10%" },
                    { mDataProp: "equipmentCode", sClass: "text-c", sTitle: "设备号", sDefaultContent: "", sWidth: "10%" },
                    { mDataProp: "runType", sClass: "text-c", sTitle: "业务类型", sDefaultContent: "", sWidth: "10%" },
                    { mDataProp: "runLog", sClass: "text-c", sTitle: "业务内容", sDefaultContent: "", sWidth: "20%" },
                    { mDataProp: "createTimeFormat", sClass: "text-c", sTitle: "创建时间", sDefaultContent: "", sWidth: "10%" }
                ],
                oLanguage: { //国际化配置
                    sProcessing: "正在获取数据，请稍后...",
                    sLengthMenu: "显示 _MENU_ 条",
                    sZeroRecords: "没有您要搜索的内容",
                    sInfo: "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
                    sInfoEmpty: "记录数为0",
                    sInfoFiltered: "(全部记录数 _MAX_ 条)",
                    sInfoPostFix: "",
                    sSearch: "从当前数据中检索： ",
                    sUrl: "",
                    oPaginate: {
                        sFirst: "首页",
                        sPrevious: "上一页",
                        sNext: "下一页",
                        sLast: "尾页"
                    }
                }
            });
        }


    </script>
}

